﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DEMOweek2
{
    class Day
    {
        private int dayNr;
        private int monthNr;
        private int year;

        


        public int MonthNr
        {
            get { return monthNr; }
            set
            {
                if (value < 1) monthNr = 1;
                else if (value > 12) monthNr = 12;
                else monthNr = value;
            }
        }

        public int DayNr                      
        {
            get { return dayNr; }
            set
            {
                if (value <= 0)
                   dayNr = 1;
                    
                else if (value > 30)
                    dayNr = 30;
                else
                    dayNr = value;               
            }
        }

        public int Year
        {
            get { return year; }
            set { year = value; }
        }

        public void ShowInfo()                        
        {
            bool inSummer =false;
            if (MonthNr ==7 || MonthNr == 8) inSummer=true;
            if (MonthNr == 6 && DayNr > 20) inSummer = true;
            if (monthNr == 9 && DayNr < 21) inSummer = true;
           
            Console.WriteLine("the date is {0} - {1} - {2}", DayNr, MonthNr, Year);
            if (inSummer == true)
                Console.WriteLine(" in the summer");
            else Console.WriteLine(" not in the summer");
        }

        public void Move1DayForward()                   
        {
            if (DayNr < 30)
                DayNr++;
            else
            {   DayNr=1;
                if (MonthNr < 12)
                     MonthNr++;
                else 
                     {MonthNr=1;
                      Year++;
                      }
            }
         }

        public Day(int d, int m, int y)
        {
            MonthNr = m;
            DayNr = d;
            Year = y;
        }
    }
}
